package com.yinNuo.collectWool.mobileApi.collectWoolApi;

import com.yinNuo.collectWool.mobileApi.entity.LoginOperationLog;
import com.yinNuo.collectWool.mobileApi.service.LoginOperationLogService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 登录操作日志表(LoginOperationLog)表控制层
 *
 * @author makejava
 * @since 2021-12-12 10:54:04
 */
@RestController
@RequestMapping("/loginOperationLog")
public class LoginOperationLogApi {
    /**
     * 服务对象
     */
    @Resource
    private LoginOperationLogService loginOperationLogService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @GetMapping("{id}")
    public ResponseEntity<LoginOperationLog> queryById(@PathVariable("id") Integer id) {
        return ResponseEntity.ok(this.loginOperationLogService.queryById(id));
    }

    /**
     * 新增数据
     *
     * @param loginOperationLog 实体
     * @return 新增结果
     */
    @PostMapping("/add")
    public ResponseEntity<LoginOperationLog> add(LoginOperationLog loginOperationLog) {
        return ResponseEntity.ok(this.loginOperationLogService.insert(loginOperationLog));
    }

    /**
     * 编辑数据
     *
     * @param loginOperationLog 实体
     * @return 编辑结果
     */
    @PutMapping("/edit")
    public ResponseEntity<LoginOperationLog> edit(LoginOperationLog loginOperationLog) {
        return ResponseEntity.ok(this.loginOperationLogService.update(loginOperationLog));
    }

    /**
     * 删除数据
     *
     * @param id 主键
     * @return 删除是否成功
     */
    @DeleteMapping("/deleteById")
    public ResponseEntity<Boolean> deleteById(Integer id) {
        return ResponseEntity.ok(this.loginOperationLogService.deleteById(id));
    }

}

